package de.fhaugsburg.games.boardgames.scrabble;

import de.fhaugsburg.games.boardgames.Board;
import de.fhaugsburg.games.boardgames.GridPoint;
import de.fhaugsburg.games.boardgames.Square;
/**
 * A ScrabbleBoard is needed for a Scrabble game, the board has several different details on its squares, called ScrabbleSquareDetails. The
 * piece which are used in scrabble are LetterPieces.
 * @author r4smus
 *
 */
public class ScrabbleBoard extends Board<LetterPiece, ScrabbleSquareDetails> {

	public ScrabbleBoard() {
		squares = new Square[15][15]; //standard size of a scrabble board

		for (int row = 0; row < getHeight(); row++) {
			for (int column = 0; column < getWidth(); column++) {
				squares[row][column] = new Square<LetterPiece, ScrabbleSquareDetails>();
				setDetails(new ScrabbleSquareDetails(SquareMultiplier.LETTERMULT_1), new GridPoint(row,column));
			}
		}
	setBoardDetails();
		
		
	}
/**
 * sets all details for the squares, if you want a shorter implementation of the method you can improve it with a symmetry algorithm. ;)	
 */
	private void setBoardDetails(){
		//set all letterMultis2
		ScrabbleSquareDetails letterMulti2 = new ScrabbleSquareDetails(SquareMultiplier.LETTERMULTI_2);
		setDetails(letterMulti2, new GridPoint(0, 3));
		setDetails(letterMulti2, new GridPoint(0, 11));
		setDetails(letterMulti2, new GridPoint(2, 6 ));
		setDetails(letterMulti2, new GridPoint(2, 8 ));
		setDetails(letterMulti2, new GridPoint(3, 0));
		setDetails(letterMulti2, new GridPoint(3, 7));
		setDetails(letterMulti2, new GridPoint(3, 14));
		setDetails(letterMulti2, new GridPoint(6, 2));
		setDetails(letterMulti2, new GridPoint(6, 6));
		setDetails(letterMulti2, new GridPoint(6, 8));
		setDetails(letterMulti2, new GridPoint(6, 12));
		setDetails(letterMulti2, new GridPoint(7, 3));
		setDetails(letterMulti2, new GridPoint(7, 11));
		setDetails(letterMulti2, new GridPoint(8, 2));
		setDetails(letterMulti2, new GridPoint(8, 6));
		setDetails(letterMulti2, new GridPoint(8, 8));
		setDetails(letterMulti2, new GridPoint(8, 12));
		setDetails(letterMulti2, new GridPoint(11, 0));
		setDetails(letterMulti2, new GridPoint(11, 7));
		setDetails(letterMulti2, new GridPoint(11, 14));
		setDetails(letterMulti2, new GridPoint(12, 6));
		setDetails(letterMulti2, new GridPoint(12, 8));
		setDetails(letterMulti2, new GridPoint(14, 3));
		setDetails(letterMulti2, new GridPoint(14, 11));
		
		//set all letterMultis3
		ScrabbleSquareDetails letterMulti3 = new ScrabbleSquareDetails(SquareMultiplier.LETTERMULTI_3);
		setDetails(letterMulti3, new GridPoint(1, 5));
		setDetails(letterMulti3, new GridPoint(1, 9));
		setDetails(letterMulti3, new GridPoint(5, 1));
		setDetails(letterMulti3, new GridPoint(5, 5));
		setDetails(letterMulti3, new GridPoint(5, 9));
		setDetails(letterMulti3, new GridPoint(5, 13));
		setDetails(letterMulti3, new GridPoint(9, 1));
		setDetails(letterMulti3, new GridPoint(9, 5));
		setDetails(letterMulti3, new GridPoint(9, 9));
		setDetails(letterMulti3, new GridPoint(9, 13));
		setDetails(letterMulti3, new GridPoint(13, 5));
		setDetails(letterMulti3, new GridPoint(13, 9));
		
		//set all wordMultis2
		ScrabbleSquareDetails wordMulti2 = new ScrabbleSquareDetails(SquareMultiplier.WORDMULTI_2);
		setDetails(wordMulti2, new GridPoint(1, 1));
		setDetails(wordMulti2, new GridPoint(1, 13));
		setDetails(wordMulti2, new GridPoint(2, 2));
		setDetails(wordMulti2, new GridPoint(2, 12));
		setDetails(wordMulti2, new GridPoint(3, 3));
		setDetails(wordMulti2, new GridPoint(3, 11));
		setDetails(wordMulti2, new GridPoint(4, 4));
		setDetails(wordMulti2,new GridPoint( 4, 10));
		setDetails(wordMulti2, new GridPoint(10, 4));
		setDetails(wordMulti2, new GridPoint(10, 10));
		setDetails(wordMulti2, new GridPoint(11, 3));
		setDetails(wordMulti2, new GridPoint(11, 11));
		setDetails(wordMulti2, new GridPoint(12, 2));
		setDetails(wordMulti2, new GridPoint(12, 12));
		setDetails(wordMulti2, new GridPoint(13, 1));
		setDetails(wordMulti2, new GridPoint(13, 13));
		
		//set all wordMultis3
		ScrabbleSquareDetails wordMulti3 = new ScrabbleSquareDetails(SquareMultiplier.WORDMULTI_3);
		setDetails(wordMulti3, new GridPoint(0, 0));
		setDetails(wordMulti3, new GridPoint(0, 7));
		setDetails(wordMulti3, new GridPoint(0, 14));
		setDetails(wordMulti3, new GridPoint(7, 0));
		setDetails(wordMulti3, new GridPoint(7, 14));
		setDetails(wordMulti3, new GridPoint(14, 0));
		setDetails(wordMulti3, new GridPoint(14, 7));
		setDetails(wordMulti3, new GridPoint(14, 14));
		
		
	}

}
